UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bmP2dxDcbQ16yu3aig8bguoTYVD6uJRGRUMRKQakKOU=' 
WHERE 
  key_id = '034207ccf1d72b6c53fae63865f2d69338786d2357f3f52046693dafa242d9b7' 
  AND (
    token = 'bmP2dxDcbQ16yu3aig8bguoTYVD6uJRGRUMRKQakKOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039