UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LgEfCMmyzB24DNnvij+9i4pjqfxLAaPWVQmb4Zvymc4=' 
WHERE 
  key_id = 'd8e9e1d30c3e78931e26fcbdbd17448eaa56f513ffd3002de8c6eeed9fdbeb3d' 
  AND (
    token = 'LgEfCMmyzB24DNnvij+9i4pjqfxLAaPWVQmb4Zvymc4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035