UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bt4AMNfNJmFvRjY9glA4HeBZKs9MiYxXWo+AoKwEnuk=' 
WHERE 
  key_id = '7d119d8b60db7eb52c3083a6dfd336a4e0cab63d1663487ecfcb0a36eee71f9d' 
  AND (
    token = 'Bt4AMNfNJmFvRjY9glA4HeBZKs9MiYxXWo+AoKwEnuk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031