UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ayRfPc0zHyLv6zuhgW/gGLNfkv1vSYnjogMiJ5JRdnk=' 
WHERE 
  key_id = '2ca5b1512ef5ff023c896fcfb544a8f0cf98e05bc57080a17a23c5422de5d238' 
  AND (
    token = 'ayRfPc0zHyLv6zuhgW/gGLNfkv1vSYnjogMiJ5JRdnk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018