UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z/3SbP8LPrKbgAehZtTZAPpYdp0ejLGsGL1gOHWugIE=' 
WHERE 
  key_id = '997ed4e0286c713e5d4af54b03c560863b12b15c59c4f509179b5b567d3eef6d' 
  AND (
    token = 'z/3SbP8LPrKbgAehZtTZAPpYdp0ejLGsGL1gOHWugIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041