UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AKsrgIsnMVEMcC1fqFIOmskuVzIQQ3slsz81uAgmzOM=' 
WHERE 
  key_id = '480e74e81650ce7d247b114efa065ef027369d4804bb9eb48fd7f8dfc596997e' 
  AND (
    token = 'AKsrgIsnMVEMcC1fqFIOmskuVzIQQ3slsz81uAgmzOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033