UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dxf636TZcXLwXtty57k9sqWwEkRZ1RORg2hQJYBpnP4=' 
WHERE 
  key_id = 'd4a1357c2c27b735ed937a63013ef6858ec6a7d92deb95b7deac0075a551acde' 
  AND (
    token = 'dxf636TZcXLwXtty57k9sqWwEkRZ1RORg2hQJYBpnP4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050