UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BM+iCiclDt7+Ofp+8AHt4ZZxDYc4fWwG+Nv319G8iAo=' 
WHERE 
  key_id = '674c3568038ac2f366e6006dba07c94aac9969679808ac2e60ac1701600fe838' 
  AND (
    token = 'BM+iCiclDt7+Ofp+8AHt4ZZxDYc4fWwG+Nv319G8iAo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024