UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dAVGqqIBxfcwWCFbS9QEb6Prk3YDaWa3/WHzbgqk/ss=' 
WHERE 
  key_id = 'f708643fb1a874e56b4a2be0dcdbe86e9542695433ba38c584da51be3f874ee8' 
  AND (
    token = 'dAVGqqIBxfcwWCFbS9QEb6Prk3YDaWa3/WHzbgqk/ss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028