UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rxb/yf3k64BJMT2naraf8GNFENTK/10l09OQ3O+OItA=' 
WHERE 
  key_id = '285cb0104ef8dd8cae53de28af987c0dd59779438d73a0f2460a07de4067fc86' 
  AND (
    token = 'Rxb/yf3k64BJMT2naraf8GNFENTK/10l09OQ3O+OItA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034