UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EsyBhHWZywNTjIatN9TXS1mL/qeBhdbUp6lUDjuX5lY=' 
WHERE 
  key_id = '9c104a36c85073483ef0060ed021271dd948054f559a02904bdeddcf61d834dd' 
  AND (
    token = 'EsyBhHWZywNTjIatN9TXS1mL/qeBhdbUp6lUDjuX5lY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034