UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ec8w0e/iw3DaqLYlbn9wIA1TTQ5l9xbcQ/cgYGDffLY=' 
WHERE 
  key_id = '3b7898b23b094e6e6b095e45b9f9beb6871b1b780148b397c681ff1864011db3' 
  AND (
    token = 'ec8w0e/iw3DaqLYlbn9wIA1TTQ5l9xbcQ/cgYGDffLY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051