UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p56qBtMX50vdDvWCGJ4ExOkyuJgw9eDVR7mTACQ1/6Q=' 
WHERE 
  key_id = '9ef7f339b3f49203b81568652e67bf991277055cc7dffc0d1bafb78097dfc014' 
  AND (
    token = 'p56qBtMX50vdDvWCGJ4ExOkyuJgw9eDVR7mTACQ1/6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048