UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yw/fW7KWgha/ZbCrL4J3zbgOd+Sq1NOWoG1pfa+JTUo=' 
WHERE 
  key_id = '25ab8f33b3147c763d398f405c4b6306c7c7f349a2f12dfcdea318a75ca81390' 
  AND (
    token = 'Yw/fW7KWgha/ZbCrL4J3zbgOd+Sq1NOWoG1pfa+JTUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046