UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YcObo5UJRxBvyxrxp4/15m9qGzDwJqBXmV5XMRYzgAc=' 
WHERE 
  key_id = '41081b5fd316aa8382e2b2a615c995ca5a0df1e464bd706146a134f9186d8f6d' 
  AND (
    token = 'YcObo5UJRxBvyxrxp4/15m9qGzDwJqBXmV5XMRYzgAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038