UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'smBqO2x8ueD/wuidCG6EZFsz3CnTvgloWR+vSEQoyN8=' 
WHERE 
  key_id = '4db5f6d797b7d3152b8e0628173a367eb0e7fa0594c5ef15927017ca3e67ff2b' 
  AND (
    token = 'smBqO2x8ueD/wuidCG6EZFsz3CnTvgloWR+vSEQoyN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028