UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JZXJYdpCEHp2DyFIPD/kjlkO7nZ8T7VzOu3RihyjRGo=' 
WHERE 
  key_id = '56f9be1d96cd0481bead5bed462f96b8209d9f647d390e1fd6660dfe375a7711' 
  AND (
    token = 'JZXJYdpCEHp2DyFIPD/kjlkO7nZ8T7VzOu3RihyjRGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020