UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eiTjWuompyseMaLPwSoyN/rQ6An5uc1rUnTpBec5Ipg=' 
WHERE 
  key_id = '8000def6a9a8521560d9a00611fe9405fc7ffce3dd2f9a9aa5e5f2a3abc90ee9' 
  AND (
    token = 'eiTjWuompyseMaLPwSoyN/rQ6An5uc1rUnTpBec5Ipg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036