UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mXTiOAWIICJGzSPtvVzt0sPND/wpvAqEEqte8cDAiJI=' 
WHERE 
  key_id = '640dd226adca6a834350fc05617c1f6bcf6ada4942fea6ca685de91d89dbc20a' 
  AND (
    token = 'mXTiOAWIICJGzSPtvVzt0sPND/wpvAqEEqte8cDAiJI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061