UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E5Ng/kOZfjBa/w/Y8UUl+WgcBC95rzgUTpnwxHfDUOc=' 
WHERE 
  key_id = '59f177a9d8843cd4704b143b8d52f1f365d624b7ea5644f5a4ae03523820479e' 
  AND (
    token = 'E5Ng/kOZfjBa/w/Y8UUl+WgcBC95rzgUTpnwxHfDUOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025