UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9MI2QRehRFnk+NvxCkD0zZd8bJb0E85IYD3Y7cxUyeQ=' 
WHERE 
  key_id = '520d84af1161c45175a6901b7d3e0551efedcc392998a59d086089a1fbcd9f8e' 
  AND (
    token = '9MI2QRehRFnk+NvxCkD0zZd8bJb0E85IYD3Y7cxUyeQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040