UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fjiH128/D8nPkszWGiFVHlbLxmusorCxUb98GwniU58=' 
WHERE 
  key_id = '29ba9bb53426f063abf17b0942106dc3c851987c16d848f2b816937689ee320a' 
  AND (
    token = 'fjiH128/D8nPkszWGiFVHlbLxmusorCxUb98GwniU58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032