UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B6VvhnFqb1l9N2kVlN9t1m9G37PoMlgEfdv+8YprayA=' 
WHERE 
  key_id = '5078c5b4001e7092910a0ef9ac63cdbfc09246dc9b1703bccce57d524ef8b855' 
  AND (
    token = 'B6VvhnFqb1l9N2kVlN9t1m9G37PoMlgEfdv+8YprayA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028