UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZJTuIMJf2WiuDmr3JUxB0joMz96t/X6AFZWuLnwo7QE=' 
WHERE 
  key_id = '25c5d579d358ecdb1160b350dfa4c4878dd838b32663574484f9e34d2e4de418' 
  AND (
    token = 'ZJTuIMJf2WiuDmr3JUxB0joMz96t/X6AFZWuLnwo7QE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024