UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G/T3XHXC1+xnOmICK2XPrVaXOxqYYwnxmmNznatSCwI=' 
WHERE 
  key_id = '4cee436a9816ca633e6932e2b2bd28cd13c5af024f3a34fa3a7a245e48928370' 
  AND (
    token = 'G/T3XHXC1+xnOmICK2XPrVaXOxqYYwnxmmNznatSCwI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034