UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OuK5DHwJPnCT52Ie/0XOWj2+Pe0va1LQO3A/yeI6ebA=' 
WHERE 
  key_id = 'f41a59f34169b598d6c3dafa48f6500d7fc9438032abca79dc47b732753c762f' 
  AND (
    token = 'OuK5DHwJPnCT52Ie/0XOWj2+Pe0va1LQO3A/yeI6ebA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041