UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1qsSnDC8uMGsxUxWu9gekBZTxDk5ME2iLGgKl6hU6p0=' 
WHERE 
  key_id = 'f49e4b798034ba478b847a967430f0f2381e81eac2d9a51987aa46f8c1b5166f' 
  AND (
    token = '1qsSnDC8uMGsxUxWu9gekBZTxDk5ME2iLGgKl6hU6p0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032