UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hFlJZtmlx+vRYqmD2AWRQUxoPEVr0L1SAFa26ZeaKj4=' 
WHERE 
  key_id = 'a27d190458f4216ea2255933d62387f96a0311d61be94efc29e604e6083fb721' 
  AND (
    token = 'hFlJZtmlx+vRYqmD2AWRQUxoPEVr0L1SAFa26ZeaKj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040